/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be.djdb.shop;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;


import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
/**
* @author Lieven Roegiers
* @copyright 2013
* @from MY_SHOP
*/
@Entity
@NamedQueries({
    @NamedQuery(name="Person.findAll",query="SELECT p FROM Person p"),
    @NamedQuery(name="Person.findByName",query="SELECT p FROM Person p WHERE p.name = :name"),
    @NamedQuery(name="Person.findByFirstname",query="SELECT p FROM Person p WHERE p.firstname = :firstname"),
})
public class Person implements Serializable{
    @Id
    @GeneratedValue(generator ="PERSON_ID")
    private int id;
    
    private static final long serialVersionUID = 1L;

    private String name;
    private String firstname;
    private String photolink;
    private String locale;
    
    @Embedded
    private Adress adress;
    @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
    private List<Phone> phone;
    private String email;
    @Enumerated(EnumType.STRING)
    private Gender gender;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getFirstname() {
        return firstname;
    }
    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }
    public String getPhotolink() {
        return photolink;
    }
    public void setPhotolink(String photolink) {
        this.photolink = photolink;
    }
    public String getLocale() {
        return locale;
    }
    public void setLocale(String locale) {
        this.locale = locale;
    }
        public Adress getAdress() {
        return adress;
    }
    public void setAdress(Adress adress) {
        this.adress = adress;
    }
    public Gender gender (){
        return this.gender;
    }

        public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


}
/**
 *     @Id @GeneratedValue(generator ="PERSON_ID")
 *     private int id;
 * 
 */